Boost
boost
arrow_drop_down
Boost.Foreach
03 Added in Boost 1.34.0
Categories: Emulation , Algorithms

In C++, writing a loop that iterates over a sequence is tedious. We can either use iterators, which requires a considerable amount of boiler-plate, or we can use the std::for_each() algorithm and move our loop body into a predicate, which requires no less boiler-plate and forces us to move our logic far from where it will be used. In contrast, some other languages, like Perl, provide a dedicated "foreach" construct that automates this process. BOOST_FOREACH is just such a construct for C++. It iterates over sequences for us, freeing us from having to deal directly with iterators or write predicates.

This Release

Eric Niebler
Maintainer

All Time

Beman Dawes
Beman Dawes
Contributor
Daniel James
Daniel James
Contributor
Marshall Clow
Marshall Clow
Contributor
Stephen Kelly
Stephen Kelly
Contributor
John Maddock
John Maddock
Contributor
Troy D. Straszheim
Troy D. Straszheim
Contributor
Eric Niebler
Eric Niebler
Contributor
Michael A. Jackson
Michael A. Jackson
Contributor
Peter Dimov
Peter Dimov
Contributor
Peter Dimov
Peter Dimov
Contributor
Glen Fernandes
Glen Fernandes
Contributor
Rene Rivera
Rene Rivera
Contributor
Edward Diener
Edward Diener
Contributor
Christopher Jefferson
Christopher Jefferson
Contributor
Vladimir Prus
Vladimir Prus
Contributor
nobody
Contributor
Douglas Gregor
Douglas Gregor
Contributor
Tanzinul Islam
Tanzinul Islam
Contributor
Martin Delille
Martin Delille
Contributor
David Jenkins
David Jenkins
Contributor
Markus Schöpflin
Contributor